<?php

require '../include/library.inc.php';

$json = json_c_decode($_POST['alldata']);
$json = json_c_decode($json);

if($_POST['type'] == 'contact')
{

$message = '<b>Name:</b> '.$json['name'].'<br>';
$message .= '<b>E-mail:</b> '.$json['email'].'<br>';
$message .= '<b>Subject:</b> '.$json['subject'].'<br>';
$message .= '<b>Message:</b><br>'.$json['message'].'<br>';


mail( ADMINISTRATOR_EMAIL,
		$json['subject'],
	    $message,
	          HTML_HEADERS."From: ".$json['name']." <".$json['email'].">");
			  
			  echo $message;
}


if($_POST['type'] == 'partner')
{


$message = '<b>Name of representative:</b> '.$json['representative'].'<br>';
$message .= '<b>Title / Position:</b> '.$json['position'].'<br>';
$message .= '<b>Phone:</b> '.$json['phone'].'<br>';
$message .= '<b>E-mail:</b> '.$json['email'].'<br><hr><br>';
$message .= '<b>Company Name:</b> '.$json['company'].'<br>';
$message .= '<b>NIPC:</b> '.$json['nipc'].'<br>';
$message .= '<b>Adress:</b> '.$json['adress'].'<br>';
$message .= '<b>Location:</b> '.$json['location'].'<br>';
$message .= '<b>Postcode:</b> '.$json['postcode'].'<br>';
$message .= '<b>District:</b> '.$json['district'].'<br>';
$message .= '<b>Country:</b> '.$json['country'].'<br>';
$message .= '<b>Phone:</b> '.$json['cphone'].'<br>';
$message .= '<b>E-mail:</b> '.$json['cemail'].'<br>';
$message .= '<b>Fax:</b> '.$json['fax'].'<br>';
$message .= '<b>Park in operation:</b> '.$json['park_in_operation'].'<br>';
$message .= '<b>Parking areas:</b> '.$json['areas'].'<br>';
$message .= '<b>Distribution / time value:</b> '.$json['ditribution'].'<br>';
$message .= '<b>Parking:</b> '.$json['parking'].'<br>';

$message .= '<b>Remarks:</b><br>'.$json['message'].'<br>';


mail( ADMINISTRATOR_EMAIL,
		'APPLICATION For Dealers',
	    $message,
	          HTML_HEADERS."From: ".$json['name']." <".$json['email'].">");
			  echo $message;
}

?>